﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TDT_Project.classes;
using Telerik.Web.UI;
using System.Data;

namespace TDT_Project.Controller
{
    public partial class uc_Xem_DeKT_Sub : System.Web.UI.UserControl
    {
        public string g_list = "";
        public string g_list_Khac = "";
        cls_phuhuynhxemdiem cls = new cls_phuhuynhxemdiem();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["nk"] != null)
                {
                    string nienkhoa = Session["nk"].ToString();
                    string Khoi = Session["Khoi"].ToString();
                    string id = Request.QueryString["ID"].ToString();
                    DataSet ds_dakt = cls.Get_DAKT_ID(Convert.ToInt32(id));
                    if (ds_dakt != null && ds_dakt.Tables[0].Rows.Count > 0)
                    {
                        lbl_tieude.Text = ds_dakt.Tables[0].Rows[0]["TieuDe"].ToString();
                        lbl_ngaydang.Text = Convert.ToDateTime(ds_dakt.Tables[0].Rows[0]["NgayDang"].ToString()).ToString("dd/MM/yyyy");
                        g_list = ds_dakt.Tables[0].Rows[0]["NoiDung"].ToString();
                        lbl_file.Text = ds_dakt.Tables[0].Rows[0]["FileURL"].ToString();
                    }
                    ds_dakt = null;
                    ds_dakt = cls.Get_DAKT_Mon(nienkhoa, Khoi, "", 5, 1);
                    if (ds_dakt != null && ds_dakt.Tables[0].Rows.Count > 0)
                    {
                        g_list_Khac += "<ul>";
                        for (int t = 0; t < ds_dakt.Tables[0].Rows.Count; t++)
                        {
                            g_list_Khac += "<li><a href='XemDAKT.aspx?pages=XemKT_sub&ID=" + ds_dakt.Tables[0].Rows[t]["ID"] + "'><img src='images/ball.jpg'/>&nbsp;" + ds_dakt.Tables[0].Rows[t]["TieuDe"] + "</a></li>";
                        }
                        g_list_Khac += "</ul>";
                    }
                }
                else
                    Response.Redirect("Default.aspx");
            }
        }
    }
}